/**
 * Created by IntelliJ IDEA.
 * User: egriffin
 * Date: Sep 10, 2008
 * Time: 2:25:15 PM
 * To change this template use File | Settings | File Templates.
 */
public class problem1 {
    public static void main(String[] args) {
        int max = 1000;
        int[] multiplesOf = {3, 5};

        int sum = 0;
        for (int i = 0; i < max; i++) {
            for (int multiple : multiplesOf) {
                if (i % multiple == 0) {
                    System.out.println(i);
                    sum += i;
                    break;
                }
            }
        }

        System.out.println(sum);
    }
}
